/**
     * class to represent state for when the fields of the
     * dialog do not match the file or the working parameter
     * values.
     */
    class BothDirty extends DirtyState {
        /**
         * Respond to a given event.
         * @return the next state.
         */
        public DirtyState nextState(int event) {
            switch (event) {
              case DIRTY_EVENT:
                  return this;
              case APPLY_EVENT:
                  if (parameters.applyParam()) {
                      fileDirty.enter();
                      return fileDirty;
                  }  // if
              case SAVE_EVENT:
                  if (parameters.saveParam()) {
                      paramDirty.enter();
                      return paramDirty;
                  }  // if
              case REVERT_EVENT:
                  if (parameters.revertParam()) {
                      paramDirty.enter();
                      return paramDirty;
                  } // if
              default:
                  String msg = "unexpected event "+event;
                  throw new IllegalArgumentException(msg);
            }  // switch (event)
        } // nextState(int)

        /**
         * This method is called when this object becomes
         * the current state.
         */
        protected void enter() {
            apply.setEnabled(true);
            revert.setEnabled(true);
            save.setEnabled(true);
        } // enter
    }    // class BothDirty
